<meta charset="utf-8">
<?php
require_once("mysql.php"); 
/*$con = mysql_connect("localhost","root","1");
if (!$con)
{
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);*/
$username=$_POST['username'];
$phone=$_POST['phone'];
$password=$_POST['password'];
$sql = "select * from work where username='$username'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
$colum=mysql_fetch_array($result);
if($count<=0)
{
	echo"<script type='text/javascript'>alert('用户名不正确');location='replace2.php';</script>";
}
else
{
	if($colum['phone']!=$phone)
	{
		echo"<script type='text/javascript'>alert('手机号不正确');location='replace2.php';</script>";
	}
	else
	{
		$sql1="Update work SET password='$password' WHERE username = '$username'";
		$resul=mysql_query($sql1); 
		if(!$resul) 
		{  
  			echo"<script type='text/javascript'>alert('密码修改失败');location='replace2.php';</script>";  
		} 
		else   
		{  
		    echo"<script type='text/javascript'>alert('密码修改成功');location='login.php';</script>";  
		}  
	}
}

?>